package com.jinsp.skinlibrary;

import android.content.Intent;
import android.content.res.AssetManager;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.jinsp.skinlib.ActivityViewManager;
import com.jinsp.skinlib.CustomViewSupport;
import com.jinsp.skinlib.FontUtils;
import com.jinsp.skinlib.SkinLibrary;

import java.io.IOException;
import java.util.Arrays;

public class MainActivity extends AppCompatActivity {

    private boolean flag;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        TextView tv_input = findViewById(R.id.tv_input);
        tv_input.setText(getString(R.string.test));
    }

    public void onClick(View view) {
        if (view.getId() == R.id.btn_switch_skin) {
            if (flag) {
                flag = false;
                SkinLibrary.changeResource(this, null);
            } else {
                flag = true;
                SkinLibrary.changeResource(this, Environment.getExternalStorageDirectory().getPath() + "/test.skin");
            }
        } else {
            startActivity(new Intent(this, MainActivity2.class));
        }
    }
}